# Contributor: Stefan Wagner <stw@bit-strickerei.de>
# Maintainer: Stefan Wagner <stw@bit-strickerei.de>
pkgname=avrdude
pkgver=7.3
pkgrel=0
pkgdesc="Download/upload/manipulate the ROM and EEPROM contents of AVR microcontrollers"
url="https://github.com/avrdudes/avrdude"
arch="all"
license="GPL-2.0-or-later"
makedepends="
	byacc
	cmake
	elfutils-dev
	flex
	hidapi-dev
	libftdi1-dev
	libgpiod-dev
	libusb-dev
	linux-headers
	samurai
	"
subpackages="$pkgname-dev $pkgname-libs $pkgname-doc"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/avrdudes/avrdude/archive/refs/tags/v$pkgver.tar.gz
	"
options="!check" # no tests

build() {
	CFLAGS="$CFLAGS -flto=auto" \
	cmake -B build -G Ninja -Wno-dev \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_INSTALL_SYSCONFDIR=/etc \
		-DHAVE_LINUXGPIO=ON \
		-DHAVE_LINUXSPI=ON \
		-DBUILD_SHARED_LIBS=ON
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
c8e314847e32f0b43c1a702d0ac95bed44d0eb434ea28b49ecf00310d46f813212910e149561fdd8bcf8d917b44f2f08660b90658c2d4cc73ae1adbb15bec8f4  avrdude-7.3.tar.gz
"
